Add compact block filter client via Kyoto#591
Add compact block filter client via Kyoto#591thunderbiscuit merged 1 commit intobitcoindevkit:masterfrom
Conversation
|
Just for fun: Binary size when including Kyoto, building the aarch64 binary on macOS using the release-smaller profile (libbdkffi.dylib): 9.7MB Not bad at all for what is likely to be one of the most popular clients one day. |
|
Awesome thank you for checking that out. Props to |
9433c63 to
d391af5
Compare
d391af5 to
44b0dea
Compare
44b0dea to
a12ab3e
Compare
f64bfbb to
48cbd2a
Compare
You can imagine my disappointment with this error message after hacking on this PR again. I'm trying to express the new It's been so long but maybe that is what I had in mind with the callback interface in the first place lol. Open to new ideas, but until we can return objects from enum variants I think we may have to stick with callbacks... |
f57905a to
4609fe1
Compare
|
I consider this ready for review now. Some updates, I added live tests for android, JVM, swift, and python. Users now have to build a Do we really need a separate live test in android when the JVM one exists? It's basically the exact same code and it would likely just increase the maintenance burden for no real benefit IMO. Should I add docstrings? I think so, but I wanted to confirm |
|
To answer your questions @rustaceanrob:
Awesome! I'll try to review this again next week. |
8861ae8 to
31653bd
Compare
thunderbiscuit
left a comment
There was a problem hiding this comment.
Just writing down some stuff as I build and test.
|
I got it working on the Android example wallet! So far so good. I'll take a closer look at the code before giving the final ACK. My first little API-related comment is that the At the moment this is what I do to pull the new blocks out of the events: override fun dialog(dialog: String) {
if (dialog.contains("peer height")) {
val height = dialog.split("peer height: ")[1].split(" ")[0]
triggerSnackbar("New block mined: $height")
}
}Which is basically a custom parsing of the string just to get what I need. I wonder if a Just to showcase my use of it, here is the simple version of the idea, where a snackbar shows when new blocks are mined: new-blocks.mp4 |
|
The best known peer height is found when connecting to a peer, but our height may not yet match theirs yet. The For reference, I believe you can achieve the same effect in terms of the client height by using |
31653bd to
3531825
Compare
|
Oh sweet yes I had not looked at all the methods carefully enough. It was easy to update the app to use that instead. 👍 |
5ca066c to
d1b98fd
Compare
|
Small note: the Android library is missing a dependency on the implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") |
3cb4250 to
54fc561
Compare
|
Added to |
54fc561 to
f83ff3e
Compare
5c24fce to
bdfb838
Compare
44b1c58 to
3f3c628
Compare
|
With the cut of the release/1.1 branch, I don't think we'll be merging anything else that'll make it in before the big release. If we end up needing to add anything to the release, we'll merge those commits right on the release branch and cherry-pick on master if needed. This means master is free to keep going at its own pace and I think this PR is ready to merge (again it will not make it into the 1.1 but rather in 1.2). No real rush, but also I feel like @rustaceanrob has been really patient and rebasing every few days... I have this working well in my @reez what do you say? Have you had a chance to test it out a bit? |
|
I can rebase this soon and I think it's ready to go. I would prefer to do follow-up patches for anything additional edit: Rebased |
3f3c628 to
2988af0
Compare
Thanks to @thunderbiscuit for getting the work started initially.
2988af0 to
d154117
Compare
|
ACK d154117. |
Description
Adds a compact block filter backend via Kyoto.
Notes to the reviewers
This description has been updated to the latest forced push as of Jan 29
Architectural notes:
The language semantics of Rust make it difficult to access the same type in two different place within a project. Due to this the
bdk_kyoto"client" is separated into smaller component types that handle logs, warnings, and wallet updates. Because the target languages for the bindings are garbage collected/reference counted, I think it is an advantage to unite all of these parts into a singleClienttype. When a user builds a new node, they receive aLightNodeandClient.The
LightNodemust be run to do anything, and a user would do so withLightNode.run().The
Clientis responsible for everything else:next_logUpdateTaking into account previous conversations, this was conveyed as a more intuitive approach than using callbacks to handle events.
Some additions in particular:
add_revealed_scriptsthat uses a&Wallet. This would be called after a user creates a transaction or reveals a receiving addressis_runningfunction to check on the nodeScanType. This is to prevent dangerous guess-work when building the client. When creating a new wallet, all that should occur is a quick sync to add the tip of the blockchain and addition of this block hash to the wallet database. This is accomplished withScanType::New. Recoveries are handled withScanType::Recoverywhere the user can select a particular height to scan from. Lastly, syncing from the last known block hash by the wallet is accomplished withScanType::Sync, which is the default.Changelog notice
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
Bugfixes: